Returns a read-only clone of this collection. If this instance is already read-only the method will return this.
Syntax
Example
Library/Library.Test/TestBTreeDictionary.cs
C# | Copy Code |
---|
BTreeDictionary<int, string> data = new BTreeDictionary<int, string>(Comparer, GetSample());
Assert.IsFalse(data.IsReadOnly);
BTreeDictionary<int, string> copy = data.MakeReadOnly();
Assert.IsFalse(ReferenceEquals(data, copy));
Assert.AreEqual(data.Count, copy.Count);
Assert.IsTrue(copy.IsReadOnly);
Assert.IsTrue(ReferenceEquals(copy, copy.MakeReadOnly()));
data = copy.Clone();
Assert.IsFalse(data.IsReadOnly);
Assert.IsFalse(ReferenceEquals(copy, data));
Assert.AreEqual(data.Count, copy.Count); |
VB.NET | Copy Code |
---|
Dim data As New BTreeDictionary(Of Integer, String)(Comparer, GetSample())
Assert.IsFalse(data.IsReadOnly)
Dim copy As BTreeDictionary(Of Integer, String) = data.MakeReadOnly()
Assert.IsFalse(ReferenceEquals(data, copy))
Assert.AreEqual(data.Count, copy.Count)
Assert.IsTrue(copy.IsReadOnly)
Assert.IsTrue(ReferenceEquals(copy, copy.MakeReadOnly()))
data = copy.Clone()
Assert.IsFalse(data.IsReadOnly)
Assert.IsFalse(ReferenceEquals(copy, data))
Assert.AreEqual(data.Count, copy.Count) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also